Focus detection method and focus detection device

ABSTRACT

A focus detection method for detecting a focus state based on object images formed through a photographing optical system in at least one focus detection area, while performing a search operation, includes determining at least one support area which overlaps the focus detection area; determining an in-focus position of the focusing lens group in the focus detection area to be an in-focus position of the focusing lens group when a brightness of the object is one of equal to and higher than a predetermined value; and determining an in-focus position of the focusing lens group upon an in-focus state being detected in the focus detection area and in the support areas which overlaps the focus detection area when the brightness of the object is lower than the predetermined value.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a focus detection method and a focusdetection device for detecting a focus state from a contrast of acaptured image.

2. Description of the Prior Art

A conventional digital camera with a contrast-detection type focusdetection system which detects a focus state by performing a searchoperation in which a focusing lens group is moved from the infinitefocus position (far extremity/position for bringing an object atinfinity into focus) to the closest (shortest) focus position (nearextremity/position for bringing an object at the shortest distance inworking range into focus), or vice versa, is known in the art, whereinthe search operation is terminated upon a peak contrast occurring duringthe search operation on the supposition that this position of thefocusing lens group at which the peak contrast is obtained is anin-focus position. Furthermore, an invention is disclosed in JapaneseUnexamined Patent Publication 2002-311325, wherein the search operationis terminated upon a plurality of peak contrasts being detectedsimultaneously at a plurality of focus detection areas, respectively,when the search operation is performed from the infinite focus positiontoward the closest focus position, and the search operation isterminated upon a peak contrast being detected at even one of theplurality of focus detection areas when the search operation isperformed from the closest focus position toward the infinite focusposition. Additionally, another invention is disclosed in JapaneseUnexamined Patent Publication 2002-072074, wherein the search operationstarts from the infinite focus position when the focusing lens group ispositioned closer to the infinite focus position than the closest focusposition, and starts from the closest focus position when the focusinglens group is positioned closer to the closest focus position than theinfinite focus position, in order to reduce the time for the searchoperation.

However, in conventional focus detection systems, even if the searchoperation is performed from the closest focus position toward theinfinite focus position, contrasts are detected by multi-pixel additionor the exposure time is extended when an object to be photographed isdark, and therefore, the search operation may be improperly terminatedupon a false peak contrast being detected under the influence ofcontrast values outside of the selected focus detection area.

SUMMARY OF THE INVENTION

The present invention provides a focus detection method and a focusdetection device by which an error focusing is prevented from occurringeven when an object is dark while the time required to bring an objectinto focus is reduced.

According to an aspect of the present invention, a focus detectionmethod is provided for detecting a focus state based on object imagesformed through a photographing optical system in at least one focusdetection area, while performing a search operation in which a focusinglens group of the photographing optical system is moved from one towardthe other of a near extremity and a far extremity, the focus detectionmethod including determining at least one support area which overlapssaid focus detection area; determining a position of the focusing lensgroup at which an in-focus state is detected in the focus detection areato be an in-focus position of the focusing lens group when a brightnessof the object is one of equal to and higher than a predetermined value;and determining a position of the focusing lens group at which thein-focus state is detected upon an in-focus state being detected in thefocus detection area and in the support area which overlaps the focusdetection area when the brightness of the object is lower than thepredetermined value.

It is desirable for the focus detection method to be based on a contrastAF system which detects contrasts of an image while moving the focusinglens group stepwise, and determines a position of the focusing lensgroup at which a peak contrast is obtained to be an in-focus position ofthe focusing lens group.

In a case where the position of the focusing lens group at which thein-focus state is detected in the focus detection area and the positionof the focusing lens group at which the in-focus state is detected inthe support area are positioned within a predetermined range of steppingpositions when the brightness of the object is lower than thepredetermined value, it is desirable for the position of the focusinglens group at which the in-focus state is detected in the focusdetection area to be determined to be the in-focus position of thefocusing lens group.

It is desirable for the focus detection area to overlap at least two ofthe focus detection areas, and, upon the in-focus states being detectedin both the focus detection areas and at least one of the two focusdetection areas, the position of the focusing lens group at which thein-focus state is detected in the focus detection area to be determinedas the in-focus position of the focusing lens group when the objectbrightness is lower than the predetermined value.

The focus detection method can include stopping the search operationupon determining the position of the focusing lens group to be thein-focus position of the focusing lens group even if the focusing lensgroup does not yet reach the other of the near extremity and the farextremity.

The focus detection method can include adding conditions in order todetermine the position of the focusing lens group to be the in-focusposition of the focusing lens group when stopping the search operationbefore the focusing lens group reaches the other of the near extremityand the far extremity.

It is desirable for each of at least two of the focus detection areas tooverlap at least one adjacent focus detection area thereof.

It is desirable for the focusing lens group to be moved stepwise by astepping motor.

It is desirable for a plurality of focus detection areas and a pluralityof support areas to be arranged within a predetermined rangecorresponding to an area defined by a focus frame.

In an embodiment, a focus detection device is provided, including animage pickup device which converts an object image that is formed via aphotographing optical system into electrical image data; a lens drivingdevice which moves a focusing lens group of the photographing opticalsystem along an optical axis thereof; and a controller for detecting afocus state based on image data, converted by the image pickup device,within at least one focus detection area and at least one support area,which overlaps the focus detection area, which are obtained at aplurality of focusing lens group positions while the focusing lens groupis moved along the optical axis via the lens driving device. Thecontroller determines a position of the focusing lens group at which anin-focus state is detected in the focus detection area to be an in-focusposition of the focusing lens group when an object brightness is one ofequal to and higher than a predetermined value. The controller detects afocus state in the focus detection area and the support area, and uponan in-focus state being detected in both the focus detection area andthe support area which overlaps the the plurality of focus detectionarea, the controller determines a position of the focusing lens group atwhich the in-focus state is detected in the focus detection area to bean in-focus position of the focusing lens group when the objectbrightness is lower than the predetermined value.

According to the present invention, the possibility of making anerroneous judgment in focusing operation is reduced because an object isbrought into focus when an in-focus state is detected in one of theplurality of focus detection areas and at least one of the plurality ofsupport areas which overlaps the one focus detection area, in the casewhere the object is dark.

The present disclosure relates to subject matter contained in JapanesePatent Application No. 2006-155905 (filed on Jun. 5, 2006), which isexpressly incorporated herein in its entirety.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention will be discussed below in detail with referenceto the accompanying drawings, in which:

FIG. 1 is a block diagram of elements of an embodiment of a digitalcamera to which a focus detecting method according to the presentinvention is applied, showing a basic configuration of the digitalcamera;

FIGS. 2A and 2B are diagrammatic sketches showing the relationshipbetween the light receiving surface of an image pickup device and aplurality of focus detection areas on the light receiving surface in thedigital camera in a multi-point distance measuring mode, wherein FIG. 2Ashows a focus frame in which the plurality of detection areas aredistributed and FIG. 2B shows the relationship between the plurality offocus detection areas and an associated plurality of support areas;

FIGS. 3A and 3B are diagrammatic sketches showing the relationshipbetween the light receiving surface of the image pickup device and asingle focus detection area on the light receiving surface in thedigital camera in a spot distance measuring mode, wherein FIG. 3A showsa focus frame in which the single focus detection area is positioned andFIG. 3B shows the relationship between the single focus detection areaand associated support areas;

FIG. 4 is a diagrammatic illustration showing the arrangement ofprimary-color filters of the image pickup device;

FIG. 5 is a flow chart showing a contrast AF process to which anembodiment of the focus detecting method according to the presentinvention is applied;

FIG. 6 is a flow chart showing a sub-routine “midway stop methoddetermining process” performed in the contrast AF process shown in FIG.5;

FIG. 7 is a flow chart showing a sub-routine “focus initializingprocess” performed in the contrast AF process shown in FIG. 5;

FIG. 8 is a flow chart showing the first half of a sub-routine “peakcheck process” performed in the contrast AF process shown in FIG. 5;

FIG. 9 is a flow chart showing the latter half of the sub-routine “peakcheck process” performed in the contrast AF process shown in FIG. 5;

FIG. 10 is a flow chart showing a sub-routine “single-peak-occurrencestop check process” performed in the peak check process shown in FIG. 9;

FIG. 11 is a flow chart showing a sub-routine “multi-peak-occurrencestop check process” performed in the peak check process shown in FIG. 9;

FIGS. 12A and 12B are graphs showing movements of the focusing lensgroup in the multi-point distance measuring mode, wherein FIG. 12A showsan example when the focusing lens group is positioned in the vicinity ofthe infinite focus position and FIG. 12B shows an example when thefocusing lens group is positioned in the vicinity of the closest focusposition;

FIGS. 13A and 13B are graphs showing movements of the focusing lensgroup in the spot distance measuring mode, wherein FIG. 13A shows anexample when the focusing lens group is positioned in the vicinity ofthe infinite focus position and FIG. 13B shows an example when thefocusing lens group is positioned in the vicinity of the closest focusposition;

FIGS. 14A and 14B are graphs showing examples of contrast valuesdetected as in-focus positions by the contrast AF process to illustratethe relationship between different positions of the focusing lens groupand the respective contrast values thereat in the contrast AF mode; and

FIGS. 15A, 15B and 15C are graphs showing examples of contrast valuesobtained by the search operation in the contrast AF process.

DESCRIPTION OF THE PREFERRED EMBODIMENT

FIG. 1 is a block diagram of essential elements of an embodiment of adigital camera having a contrast-detection type of multi-point distancemeasuring to which the present invention is applied.

This digital camera is provided with a photographing lens L including afocusing lens group L1, and an image pickup device (CCD image sensor) 11serving as an imaging device. An object image is formed on a lightreceiving surface 12 (see FIG. 2) of the image pickup device 11 via thephotographing lens L. The image pickup device 11 includes a large numberof pixels (photoelectric transducing elements) arranged in atwo-dimensional matrix at predetermined intervals. The digital camera isfurther provided with an image signal processing circuit 13, an LCDmonitor 17, an image memory control circuit 19, and an image memory 21.Each pixel of the image pickup device 11 converts the incident light ofan object image thereon into an electrical charge, and the electricalcharges are accumulated (integrated). Upon completion of an exposure,the accumulated charges are output, pixel by pixel, as an image signalto the image signal processing circuit 13. The image signal processingcircuit 13 performs predetermined adjusting processes such as awhite-balance adjusting process and an A/D converting process on theinput image signal to output digital image data to a CPU 15. Namely,image data to which a predetermined process has been given and convertedinto digital image data in units of pixels are output to the CPU 15. TheCPU 15 converts the input image data into an image signal capable ofbeing indicated on the LCD monitor 17 to visually indicate the imagedata on the LCD monitor 17 in a through mode (monitoring mode), capturesthe image within the selected detection area or areas when the contrastAF process is performed, and converts the input image data into imagedata having a predetermined format to write this image data into theimage memory 21 via the image memory control circuit 19 in an imagerecording mode.

FIG. 2A and 2B show the relationship between five focus detection areasMM0, MM1, MM2, MM3 and MM4 and six support areas MS0, MS1, MS2, MS3, MS4and MS5 which support these five focus detection areas as an example ofthe light receiving surface (imaging surface) 12 of the image pickupdevice 11 provided with a plurality of focus detection areas formulti-point distance measurement. FIG. 2A shows a focus frame (AF frame)12 a which includes the five focus detection areas MM0, MM1, MM2, MM3and MM4 and the six support areas MS0, MS1, MS2, MS3, MS4 and MS5, andFIG. 2B schematically shows a state of overlapping among the five focusdetection areas MM0, MM1, MM2, MM3 and MM4 and the six support areasMS0, MS1, MS2, MS3, MS4 and MS5.

In the present embodiment of the digital camera, the focus detectionarea MM1 overlaps each of the two focus detection areas MM0 and MM3adjacent to the focus detection area MM1, and the focus detection areaMM2 overlaps each of the two focus detection areas MM0 and MM4 adjacentto the focus detection area MM2.

Additionally, the two support areas MS0 and MS1 overlap the focusdetection area MM0 from the laterally opposite sides thereof,respectively, while overlapping each other; the two support areas MS0and MS2 overlap the focus detection area MM1 from the laterally oppositesides thereof, respectively, while overlapping each other; the twosupport areas MS1 and MS3 overlap the focus detection area MM2 from thelaterally opposite sides thereof, respectively, while overlapping eachother; the two support areas MS2 and MS4 overlap the focus detectionarea MM3 from the laterally opposite sides thereof, respectively, whileoverlapping each other; and the two support areas MS3 and MS5 overlapthe focus detection area MM4 from the laterally opposite sides thereof,respectively, while overlapping each other.

The overlapping and supplemental relationship between the five focusdetection areas MM0, MM1, MM2, MM3 and MM4 and the six support areasMS0, MS1, MS2, MS3, MS4 and MS5 is as follows.

The focus detection area MM0 is supported by the two support areas MS0and MS1, the focus detection area MM1 is supported by the two supportareas MS0 and MS2, the focus detection area MM2 is supported by the twosupport areas MS1 and MS3, the focus detection area MM3 is supported bythe two support areas MS2 and MS4, and the focus detection area MM4 issupported by the two support areas MS3 and MS5.

The focus detection area MM0 and the two support areas MS0 and MS1 areused as a group of focus detection areas for detecting a focus state,the focus detection area MM1 and the two support areas MS0 and MS2 areused as a group of focus detection areas for detecting a focus state,the focus detection area MM2 and the two support areas MS1 and MS3 areused as a group of focus detection areas for detecting a focus state,the focus detection area MM3 and the two support areas MS2 and MS4 areused as a group of focus detection areas for detecting a focus state,and the focus detection area MM4 and the two support areas MS3 and MS5are used as a group of focus detection areas for detecting a focusstate.

FIG. 3 shows the relationship between a focus detection area SM0 and twosupport areas SS0 and SS1 which support the focus detection area SM0 asan example of the light receiving surface (imaging surface)12 of theimage pickup device 11 provided with a single focus detection area forspot distance measurement. FIG. 3A shows a focus frame (AF frame) 12 bwhich includes the focus detection area SM0 and the two support areasSS0 and SS1, and FIG. 3B schematically shows a state of overlappingamong the focus detection area SM0 and the two support areas SS0 andSS1.

In the present embodiment of the digital camera, each support area (MS0through MS5 and SS0 and SS1) is used to improve the accuracy of theassociated overlapping focus detection area, i.e., to improve theaccuracy in detection of contrast of the object image included in theoverlapping portion, and is not used to make a selection of focusdetection areas MM0 through MM4. In addition, in the present embodimentof the digital camera, the focus frame 12 b used for the spot distancemeasurement than the focus frame 21 a used in the multi-point distancemeasurement.

Although not shown in detail in the drawings, primary-color filters (red(R), green (G) and blue (B) filters) are disposed in front of each pixel(photoelectric transducing element) on the object side thereof, and eachpixel on the light receiving surface 12 transduces the red, green andblue components of the incident rays of object light that are passedthrough the primary-color filters into electrical charges, and theseelectrical charges are accumulated. The electrical charges thusaccumulated for a predetermined period of time are read out of the imagepickup device 11 pixel by pixel to be output as an image signal.

FIG. 4 shows the pattern of the primary-color filters included in thefocus detection area MM0 in the light receiving surface 12. In theillustrated embodiment of the digital camera, a typical arrangement(Bayer array) of primary-color filters is adopted. The primary-colorfilters include GR (green and red) lines, each of which includes twokinds of filters (filters G and R), alternately arranged in thehorizontal direction, and BG (blue and green) lines, each of whichincludes two kinds of filters (filters B and G), alternately arranged inthe horizontal direction. The GR lines and the BG lines are alternatelyarranged in the vertical direction. In the illustrated embodiment of thedigital camera, four pixels (a 2 by 2 matrix of pixels) in each square,namely, a combination of two green filters (two filters G), a red filter(filter R) and a blue filter (filter B) is treated as one pixel block,and the sum of the magnitudes of image signals integrated by the fourpixels in each pixel block is regarded as intensity a_(n)(a_(n)=G+R+B+G).

Accordingly, an operation for determining the difference between theintensity a_(n) of a pixel block and the intensity a_(n) of anotherpixel block positioned one pixel-block away from the previous pixelblock in the horizontal direction is repeated successively in thehorizontally rightward direction within the focus detection area MM0while the differences thus determined (a_(n+)−a_(n)) are added up. Uponcompletion of these difference determining and adding operations on thepixel block at the right end of the focus detection area MM0 in thehorizontal direction, the difference determining and adding operationsare repeated on a subsequent row of pixel blocks one pixel block belowthe previous row of pixel blocks in the vertical direction untilcompletion of the determining operation on the pixel block at the rightend of the focus detection area MM0 in the horizontal direction andcompletion of the adding operation thereof. Such difference determiningand adding operations are repeated up to the right end of the focusdetection area MM0 in the bottom row thereof.

The sum of the differences (a_(n+2)−a_(n)) on the focus detection areaMM0 corresponds to the contrast value on the focus detection area MM0 atthe current position of the focusing lens group L1. The contrast valuecan be represented by the following expression 1:

$\begin{matrix}{\sum\limits_{n = 0}^{\max}( {a_{n + 2} - a_{n}} )^{2}} & \lbrack {{Expression}\mspace{14mu} 1} \rbrack\end{matrix}$

Each of the remaining four focus detection areas MM1 through MM4, thefocus detection area SM0, the six support areas MS0 through MS5 and thetwo support areas SS0 and SS1 has an identical structure and controlmethod to the focus detection area MM0.

In the contrast AF mode in the present embodiment of the digital camera,a combination of a CCD high-speed drive mode and a small pixel-countaddition mode, and a combination of a CCD low-speed drive mode and alarge pixel-count addition mode (VGA) are switched according to thebrightness of an object to be photographed.

The above described control of the image pickup device is carried out inthe small pixel-count addition mode in the case where the image pickupdevice 11 operates in the CCD high-speed drive mode (in which theexposure time of the image pickup device 11 is short) when thebrightness of the object is high.

In the case of a low-brightness object, the image pickup device 11operates in the CCD low-speed drive mode (in which the exposure time ofthe image pickup device is long) and in the large pixel-count additionmode, in which, e.g., the intensities of four pixel blocks (sixteenpixels in total) are added up or the intensities of four-by-four pixels(sixteen pixels in total) centered on each pixel block (consisting oftwo green filters, a red filter and a blue filter) are added up.

In the present embodiment of the compact digital camera, the CPU 15performs an image capturing process on the image pickup device 11 whilemoving the focusing lens group L1 stepwise via the motor driver 27, theAF motor 25 and the lens drive mechanism 23 (which constitute a lensdriving device); inputs the image signals from the preselected detectionareas among the image signals of the captured image to determine thecontrast values on the preselected detection areas, respectively; andstores the determined contrast values in an internal RAM of the CPU 15as contrast data. The CPU 15 repeats the contrast AF process whilemoving the focusing lens group L1 stepwise in the direction from theclosest focus position (one end of the range of movement of the focusinglens group L1) to the infinite focus position (the other end of therange of movement of the focusing lens group L1), or vice versa.

The position (lens position) of the focusing lens group L1 in theoptical axis direction is detected using an origin sensor 23 a and anorigin sensor 23 b with the closest focus position (near extremity) andthe infinite focus position (far extremity) of the focusing lens groupL1 being predetermined as two points of origin, respectively, and iscounted as the number of drive pulses from either point of origin. Thedrive pulses are defined as, e.g., pulses output from an encoder 26 suchas a photo-interrupter installed on the output shaft of the AF motor 25.Although several hundreds of pulses or more are usually necessary fordriving the focusing lens group L1 from the closest focus position tothe infinite focus position, it is assumed that several pulses orseveral dozen pulses are only necessary for driving the focusing lensgroup L1 (while capturing images) in a stepwise manner from the closestfocus position to the infinite focus position in a contrast AF process(see FIG. 5) in the present embodiment of the digital camera for thepurpose of simplifying the description, and that one step corresponds toone drive pulse and one position pulse.

In addition, in the present embodiment of the digital camera, in eitherof the two cases where a search operation (scanning operation) in whichthe focusing lens group L1 is moved from the closest focus position tothe infinite focus position is performed and where a search operation inwhich the focusing lens group L1 is moved from the infinite focusposition to the closest focus position is performed, the position pulse(lens position pulse) at the initial position of the focusing lens groupL1 is 0, the position pulses are added up when the focusing lens groupL1 is driven stepwise from the initial position thereof to anotherposition, and a position pulse is subtracted from the position pulsesthus added up step by step when the focusing lens group L1 is drivenstepwise in the opposite direction toward the initial position thereof.

[Search Operation Midway Stop]

In the present embodiment of the digital camera, upon a peak contrastoccurring during the search operation in the contrast AF process, thesearch operation is terminated under predetermined conditions to therebymake it possible to reduce the time for focus adjustment with nofocusing error.

[In the Case of Bright Object]

The present embodiment of the digital camera operates in the CCDhigh-speed drive mode, the large pixel-count addition mode, and asingle-peak-occurrence stop mode (the details thereof will be discussedin later) in the contrast AF mode when the brightness of the object ishigh.

In the case of detecting a contrast when the brightness of the object ishigh in the small pixel-count addition mode, the exposure time of theimage pickup device 11 is short and the sum of pixel additions issmaller than in the case detecting a contrast when the brightness of theobject is low in the large pixel-count addition mode, so that there is alittle possibility of contrasts outside of the selected detection areabeing picked up on one occasion and not picked up on another occasion.Accordingly, the search operation is terminated (during the progressthereof) upon a peak contrast occurring in any of the five focusdetection areas MM0 through MM4 in the multi-point distance measuringmode, and the search operation is terminated upon a peak contrastoccurring in the focus detection area SM0 in the spot distance measuringmode.

Due to this operation terminating the search operation during theprogress thereof, a further reduction in time required for focusadjustment can be achieved.

[In the Case of Dark Object]

The present embodiment of the digital camera operates in the CCDlow-speed drive mode, the large pixel-count addition mode, and amulti-peak-occurrence stop mode (the details thereof will be discussedin later) in the contrast AF mode when the brightness of the object islow.

In the case of detecting a contrast when the brightness of the object islow in the large pixel-count addition mode, the exposure time of theimage pickup device 11 is long, so that it is often the case thatcontrasts outside of the selected detection area are picked up on oneoccasion and not picked up on another occasion due to hand shake (camerashake), or the like, during the search operation. Moreover, the numberof pixel values increases due to the large pixel-count addition mode(VGA), and accordingly, it is often the case that contrasts outside ofthe selected detection area are picked up on one occasion and not pickedup on another occasion and there is a high possibility of a false peakcontrast occurring. To prevent this from occurring, in the presentembodiment of the digital camera, the search operation is terminatedimmediately after a peak contrast occurs in any of the five focusdetection areas MM0 through MM4 and a peak contrast occurs in either ofthe associated two support areas (MS0 and MS1, MS0 and MS2, MS1 and MS3,MS2 and MS4, or MS3 and MS5) at the same time in the multi-pointdistance measuring mode, while the search operation is terminatedimmediately after a peak contrast occurs in the focus detection area SM0and a peak contrast occurs in either of the two support areas SS0 andSS1 at the same time in the spot distance measuring mode.

The chances of a false peak contrast being detected are remote and thepossibility that a focusing error may occur is low if the searchoperation is terminated at such a moment rather than terminated upon apeak contrast occurring in one of the five focus detection areas MM0through MM4 in the multi-point distance measuring mode.

The occurrence of a peak contrast in each support area can be within therange of two or three successive pulse positions. In this case, it canbe set to select a focus detection area, the closest focus position orsome midway point between the closest focus position and the infinitefocus position.

[Direction of the Search Operation]

In the case where the focus detection area is large or many focusdetection areas are distributed in a wide range though one focusdetection area is small, i.e., in the case of the multi-point distancemeasurement, the direction of the search operation (the direction ofmovement of the focusing lens group L1 in the search operation) islimited to the direction from the closest focus position toward theinfinite focus position regardless of the current stop position of thefocusing lens group L1 (see FIGS. 12A and 12B). In the case where thefocus detection area is small, e.g., in the case of a spot distancemeasurement, the direction of the search operation is set to either thedirection from the infinite focus position toward the closest focusposition (see FIG. 13A) or the direction from the closest focus positiontoward the infinite focus position (see FIG. 13B) depending on thecurrent stop position of the focusing lens group L1.

[In the Case of Multi-Point Distance Measurement]

In the case of the multi-point distance measuring mode that uses thelarge focus frame 12 a, the direction of the search operation is limitedto the direction from the closest focus position toward the infinitefocus position. Since it is sometimes the case that images of near andfar objects are included in the plurality of focus detection areas, thenear object is given priority in being brought into focus by limitingthe direction of the search operation to the direction from the closestfocus position toward the infinite focus position.

[In the Case of Spot Distance Measurement]

In the case of the spot distance measuring mode that uses the smallfocus frame 12 b, the direction of the search operation is allowed to beeither direction, i.e., from the infinite focus position to the closestfocus position, or vice versa. In the spot distance measurement, thechances of images of near and far objects being included in the focusdetection area are remote, and accordingly, the time for focusadjustment can be reduced by terminating the search operation upon apeak contrast occurring after the commencement of the search operation.

Operations of the contrast AF process performed in the presentembodiment of the digital camera will be discussed with reference to theflow charts shown in FIGS. 5 through 11. The contrast AF in thisparticular embodiment of the digital camera is a so-called one-shot AF,in which control enters the flow chart shown in FIG. 5 upon thephotometering switch SWS being turned ON and stops upon an object beingbrought into focus.

In the contrast AF process, firstly various variables, etc., areinitialized (step S101). For instance, each status (flag) is cleared(i.e., set to 0), contrast values are cleared, a lens-position pulsenumber PN is initialized (PN=0), the maximum contrast value is set to 0,the minimum contrast value is set to FFFFFFFF, a midway-stopidentification flag is cleared, a midway-stop OK flag is cleared, andthe number of detection areas is set according to the focal length.

Variables and others are defined as follows.

Contrast values are those actually obtained at each focus detection areaor support area.

Given that the lens-position pulse number PN is 0 when the focusing lensgroup L1 is positioned at one of the closest focus position and theinfinite focus position which serves as the initial position of thefocusing lens group L1, the lens-position pulse number PN is a variablewhich is incremented by one every time the encoder 26 outputs one pulse(drive pulse) when the AF motor 25 is driven in the direction toward theother of the closest focus position and the infinite focus position.Accordingly, when the AF motor 25 is driven to move the focusing lensgroup L1 in the direction toward the initial position thereof, thelens-position pulse number PN is decremented by one every time theencoder 26 outputs one pulse (drive pulse).

The maximum contrast value and the minimum contrast value are variablesto which actually-obtained maximum and minimum contrast values areassigned, respectively.

The midway-stop identification flag (PerhapsOK flag) is a flag foridentification of a midway stop of the search operation. Specifically,the midway-stop identification flag “0” and “1” indicate that the searchoperation without and with a midway stop, respectively.

The midway-stop OK flag (StopOK flag) is a flag which enables ordisables the search operation. Specifically, the midway-stop OK flags“0” and “1” disable and enable the search operation, respectively.

A mid way-stop check flag (StopCheck flag) is a flag which indicateswhether or not to check conditions of the midway stop of the searchoperation. Specifically, the midway-stop check flags “0” and “1”indicate not to check and to check conditions of the midway stop of thesearch operation, respectively.

After the completion of the above described initializing process at stepS101, a midway stop method determining process is performed (step S103).Namely, it is determined whether the search operation is terminated uponat least two peak contrasts occurring simultaneously in at least twoareas (one focus detection area and at least one associated supportarea), respectively, or the search operation is terminated upon a peakcontrast occurring in any of the five focus detection areas.

A condition for determining the way to stop the search operation can beeither the object brightness or a CCD drive mode of the image pickupdevice (CCD image sensor) 11 that operates in association with objectbrightness.

Subsequently, a focus initializing process (see FIG. 7) is performed(step S105). In this focus initializing process, the focusing lens groupL1 is moved to the initial position thereof in accordance with thecurrent focus position (current lens position) and the selected focusdetection area or areas.

Thereafter, a contrast value calculating process at the initial stopposition (current position) of the focusing lens group L1 is performed(step S107). Namely, based on the image data input from the image pickupdevice 11, the contrast value P[0] at the initial position of thefocusing lens group L1 is calculated, and the maximum contrast value Maxand the minimum contrast value Min are updated.

Subsequently, the direction of the search operation is determined (stepS109). In the case where the focusing lens group L1 is moved to theclosest focus position by the focus initializing process at step S105,the direction of the search operation is determined as the directiontoward the infinite focus position at step S109. In the case where thefocusing lens group L1 is moved to the infinite focus position by thefocus initializing process at step S105, the direction of the searchoperation is determined as the direction toward the closest focusposition at step S109.

Thereafter, the AF motor 25 is driven by one step in the direction ofthe search operation determined at step S109 (step Sill) Subsequently,the lens-position pulse number PN is increased by one (step S113).Subsequently, a contrast value P[PN] is calculated in accordance withimage data input from the image pickup device 11, and the maximumcontrast value and the minimum contrast value are updated (step S115).

Subsequently, a peak check process (see FIG. 8) is performed whichdetermines whether or not the contrast value P[PN] calculated at stepS115 is a peak contrast value which satisfies preset conditions (stepS117).

The contrast value calculating process at step S115 and the peak checkprocess at step S117 are performed on all the focus detection areasselected at step S101.

Subsequently, it is determined whether or not the midway-stop OK flag is“1” (step S119). If the midway-stop OK flag is not “1” (if NO at stepS119), it is determined whether or not the focusing lens group L1 hasreached the search end extremity thereof (step S121). If the focusinglens group L1 has not reached the search end extremity thereof (if NO atstep S121), control returns to step S111 so that the above describedoperations at steps S111 through S119 are repeated.

The operations at steps S111 through S121 are repeated while thefocusing lens group L1 is moved stepwise toward the search end extremityin units of drive pulses (if NO at step S121).

If the focusing lens group L1 has reached the search end extremitythereof (if YES at step S121) or if the midway-stop OK flag is “1” (ifYES at step S119), the AF motor 25 is stopped (step S123). Subsequently,a peak calculation process for calculating a peak contrast value (bylinear approximation) is performed in accordance with the five contrastvalues at consecutive five lens positions which are obtained in the loopprocess at steps S111 through S121 (step S125). Namely, an estimatedmore precise peak contrast value and the position thereof are calculatedby linear approximation because there is a possibility of a real peakcontrast value existing in the vicinity of a peak contrast value amongthe contrast values respectively calculated at the stepping positions.

Subsequently, an area selection process is performed at step S127. Inthe area selection process, one of the focus detection areas in which avalue at the closest distance is obtained in accordance with the peakcontrast value obtained at each focus detection area is selected as anin-focus area in the multi-point distance measuring mode (step S127),and the focusing lens group L1 is moved to the lens position thereof atwhich a peak contrast value is obtained in this in-focus area (stepS129). Thereafter, contrast AF process is ended.

[Determination of Midway Stop Method]

The midway stop method determining process that is performed at stepS103 will be hereinafter discussed in detail with reference to the flowchart shown in FIG. 6.

In the midway stop method determining process, it is determined whetheror not the CCD drive mode is the CCD high-speed drive mode (step S201).The image pickup device 11 operates in the CCD high-speed drive mode(short-time exposure mode) when object brightness is equal to or higherthan a predetermined value, or operates in the CCD low-speed drive mode(long-time exposure mode) when object brightness is lower than thepredetermined value.

In the case of the CCD high-speed drive mode (if YES at step S201), thesingle-peak-occurrence stop mode is set (at step S203) and controlreturns. In the case of the CCD low-speed drive mode (if NO at stepS201), the multi-peak-occurrence stop mode is set (at step S205) andcontrol returns.

In the single-peak-occurrence stop mode, the search operation isterminated upon a peak contrast occurring in any of the five focusdetection areas MM0 through MM4 in the case of the multi-point distancemeasuring mode, or the search operation is terminated upon a peakcontrast occurring in the focus detection area SM0 in the case of thespot distance measuring mode.

In the multi-peak-occurrence stop mode, the search operation isterminated immediately after a peak contrast occurs in any of the fivefocus detection areas MM0 through MM4 and a peak contrast occurs ineither of the associated two support areas (MS0 and MS1, MS0 and MS2,MS1 and MS3, MS2 and MS4, or MS3 and MS5) at the same time in the caseof the multi-point distance measuring mode, or the search operation isterminated immediately after a peak contrast occurs in the focusdetection area SM0 and a peak contrast occurs in either of the twosupport areas SS0 and SS1 at the same time in the case of the spotdistance measuring mode.

[Focus Initializing Process]

The focus initializing process that is performed at step S105 in thecontrast AF process will be discussed in detail with reference to theflow chart shown in FIG. 7.

In the focus initializing process, firstly it is determined whether ornot the currently-set distance measuring mode is the multi-pointdistance measuring mode (step S301). If the currently-set distancemeasuring mode is the multi-point distance measuring mode (if YES atstep S301), a toward-near-extremity drive process is performed (stepS305). In the toward-near-extremity drive process, the AF motor 25 isdriven to move the focusing lens group L1 toward the closest focusposition (near extremity). If the currently-set distance measuring modeis not the multi-point distance measuring mode (if NO at step S301), itis determined whether or not the current position of the focusing lensgroup L1 is in the vicinity of the closest focus position (step S303).If the current position of the focusing lens group L1 is in the vicinityof the closest focus position (if YES at step S303), thetoward-near-extremity drive process is performed (step S305) and controlproceeds to step S309. If the current position of the focusing lensgroup L1 is not in the vicinity of the closest focus position (if NO atstep S303), a toward-far-extremity drive process is performed (stepS307). In the toward-far-extremity drive process, the AF motor 25 isdriven to move the focusing lens group L1 toward the infinite focusposition (far extremity).

Thereafter, whether or not the focusing lens group L1 has reached theclosest focus position, or the infinite focus position, is repeatedlychecked until the focusing lens group L1 reaches the closest focusposition or the infinite focus position (step S309). Upon the focusinglens group L1 reaching the closest focus position or the infinite focusposition (if YES at step S309), control returns.

With the above described focus initializing process, in the multi-pointdistance measuring mode, the focusing lens group L1 is moved to theclosest focus position as the initial position (search starting point)thereof regardless of the current position of the focusing lens groupL1, while the infinite focus position is set as the search endextremity. On the other hand, in the spot distance measuring mode, thefocusing lens group L1 is moved to one of the closest focus position andthe infinite focus position as the initial position (search startingpoint) when the current position of the focusing lens group L1 is in thevicinity of the closest focus position and the infinite focus position,respectively, while the other of the closest focus position and theinfinite focus position is set as the search end extremity.

[Peak Check Process]

The peak check process that is performed at step S117 will behereinafter discussed in detail with reference to the flow chart shownin FIGS. 8 and 9. The peak check process is for determining a peakcontract value in each focus detection area from the contrast valueP[PN] on each lens-position pulse number PN which is obtained whilemoving the focusing lens group L1 stepwise. In the present embodiment ofthe digital camera, based on a group of obtained contrast values P[PN]at consecutive five lens positions (five stepping positions), contrastvalues at two adjacent lens positions of the focusing lens group L1 arecompared with each other successively in the direction from the searchstarting point (initial position) toward the search end extremity of thefocusing lens group L1, to determine whether or not the contrast valueincreases two times (first predetermined number of times) consecutively,and subsequently decreases two times (second predetermined number oftimes) consecutively, i.e., whether or not the contrast value of themiddle (third) lens position of the five lens positions is a peakcontrast value. Thereafter, in the case where the contrast valueincreases two times consecutively, and subsequently decreases two timesconsecutively, the maximum contrast value P[PN] at that time isdetermined to be a peak contrast (maximum value).

In the peak check process, firstly the current lens-position pulsenumber PN is assigned as a lens-position pulse number PN (step S401).

Subsequently, the midway-stop check flags set at each focus detectionarea and the associated support areas are all initialized (set to 0)(steps S402, S403 and S404). The midway-stop check flag is a flag fordeterring a checking operation from being performed in which it ischecked whether or not conditions of the midway stop of the searchoperation are satisfied for that area. Specifically, the midway-stopcheck flags “0” and “1” indicate determent and allowance, respectively.

Subsequently, it is determined whether or not the lens-position pulsenumber PN is greater than 5 (step S405) Namely, it is determined whetheror not at least five consecutive positions necessary for calculatingfive peak contrast values at consecutive five lens positions are withina range in which contrast values can be obtained. If the lens-positionpulse number PN is not greater than 5 (if NO at step S405), controlproceeds to step S423 shown in FIG. 9. If the lens-position pulse numberPN is greater than 5 (if YES at step S405), the operations at steps S407through S421 are repeated for each focus detection area (step S406through step S422).

It is determined whether or not the contrast value increases two timesconsecutively, and subsequently decreases two times consecutively basedon a group of obtained five contrast values at consecutive five lenspositions from the immediately preceding lens position (PN-1) to thefour preceding lens position (PN-5) (step S407). Otherwise (if NO atstep S407), control returns to step S406 so that the operation at stepS407 is performed for the subsequent focus detection area.

If the contrast value increases two times consecutively, andsubsequently decreases two times consecutively (if YES at step S407; seeFIG. 14A), 80 percent of the contrast value (P[PN-3]) of the lensposition (PN-3) that becomes a maximum value among the group of obtainedfive contrast values is assigned to a lower limit value dat0 (stepS409). Subsequently, it is determined whether or not a first conditionfor reliability is satisfied, i.e., whether or not either the contrastvalue P[PN-5] at the lens position (PN-5), which is one of the oppositeend positions of the five lens positions, or the contrast value P[PN-1]at the lens position (PN-1), which is the other of the opposite endpositions of the five lens positions, is smaller than the lower limitvalue dat0 (step S411). Namely, it is determined whether or not thedifference between the peak contrast value and each contrast value atthe opposite end positions of the five lens positions is sufficientlylarge. If neither of the contrast value P[PN-5] at the lens position(PN-5) and the contrast value P[PN-1] at the lens position (PN-1) issmaller than the lower limit value dat0 (if NO at step S411), controlreturns to step S406 so that the operations at steps S407 through S411are performed for the subsequent focus detection area. This is becauseit is assumed that the reliability of the peak contrast value is lowsince the contrast variation is small.

If either the contrast value P[PN-5] at the lens position (PN-5) or thecontrast value P[PN-1] at the lens position (PN-1) is smaller than thelower limit value dat0 (if YES at step S411), it is determined whetheror not a second condition for reliability is satisfied, i.e., whether ornot the difference between the peak contrast value P[PN-3] and theminimum contrast value among all the contrast values obtained by theprevious processes performed thus far is greater than 10 percent of thepeak contrast value P[PN-3] (step S413). Otherwise (if NO at step S413),control returns to step S406 so that the operations at steps S407through S413 are performed for the subsequent focus detection area. Thisis because it is assumed that the reliability of the peak contrast valueis low since the peak contrast value is small.

If the difference between the peak contrast value P[PN-3] and theminimum contrast value among all the contrast values obtained by theprevious processes performed thus far is greater than 10 percent of thepeak contrast value P[PN-3] (if YES at step S413), it is determinedwhether or not a third condition for reliability is satisfied, i.e.,whether or not the peak contrast value P[PN3] is equal to or greaterthan the maximum contrast value (step S415).

If the peak contrast value P[PN3] is not equal to or greater than themaximum contrast value (if NO at step S415), control returns to stepS406 so that the operations at steps S407 through S415 are performed forthe subsequent focus detection area.

If the peak contrast value P[PN3] is equal to or greater than themaximum contrast value (if YES at step S415), the lens-position pulsenumber (PN-3) at which the peak contrast value P[PN-3] has been obtainedis assigned to a position index INDEX while a peak existence flag STATUSis set to “1” (step S417), and control proceeds to step S419.

It should be noted that the position index INDEX is a variable to whicha lens-position pulse number for stopping the focus lens group L1 at alens position thereof as an in-focus position is assigned and that thefocusing lens group L1 is moved to the position of the lens-positionpulse number represented by the set position index INDEX after thesearch operation is terminated. The peak existence flag STATUS is a flagfor distinguishing whether or not a peak contrast value has beenobtained.

At step S419 it is determined whether or not the contrast values P[PN-5]and P[PN-1], that are obtained at the opposite end positions ofconsecutive five lens positions at which a group of five contrast valuesare respectively obtained by the peak check process, are greater thanthe contrast values P[PN-6] and P[PN], respective, that are obtained atlens positions immediately after and before the aforementioned oppositeend positions at which the contrast values P[PN-5] and P[PN-1] areobtained, respectively. Namely, it is determined whether or not the peakcontrast value P[PN-3] is a peak contrast value obtained in the casewhere the contrast value increases three times consecutively, andsubsequently decreases three times consecutively (see FIG. 14B). If thepeak contrast value P[PN-3] is such a peak contrast value (if YES atstep S419), the midway-stop check flag is set to “1” (step S421) andcontrol proceeds to step S423. If the peak contrast value P[PN-3] is notsuch a peak contrast value (if NO at step S419), control returns to stepS406 so that the operations at steps S407 through S419 are performed forthe subsequent focus detection area. Since strict conditions are set upin the case of terminating the search operation during the progressthereof, the possibility of an error focusing occurring is low.

Upon the operations at steps S406 through S421 being performed on allthe focus detection areas MM0 through MM4 or the focus detection areaSM0, control proceeds to step S423 from step S422. It is determined atstep S423 whether or not the digital camera is currently in themulti-peak-occurrence stop mode. If the digital camera is not currentlyin the multi-peak-occurrence stop mode (if NO at step S423), controlproceeds to step S443. If the digital camera is currently in themulti-peak-occurrence stop mode (if YES at step S423), control proceedsto step S425. The process from step S425 to S442 is substantially thesame as the process from step S405 to step S422 and performed on all thesupport areas MS0 through MS5 or the support areas SS0 and SS1.

It is determined at step S425 whether or not the lens-position pulsenumber PN is greater than 5. Namely, it is determined whether or not atleast five consecutive positions necessary for calculating five peakcontrast values at consecutive five lens positions are within a range inwhich contrast values can be obtained. If the lens-position pulse numberPN is not greater than 5 (if NO at step S425), control proceeds to stepS443. If the lens-position pulse number PN is greater than 5 (if YES atstep S425), the operations at steps S427 through S441 are repeated foreach support area (step S426 through step S442).

It is determined whether or not the contrast value increases two timesconsecutively, and subsequently decreases two times consecutively basedon a group of obtained five contrast values at consecutive five lenspositions from the immediately preceding lens position (PN-1) to thefour preceding lens position (PN-5) (step S427). Otherwise (if NO atstep S427), control returns to step S426 so that the operation at stepS427 is performed for the subsequent support area, or proceeds to stepS443 in the case of the last support area (steps S426 through S442, andstep S443).

If the contrast value increases two times consecutively, andsubsequently decreases two times consecutively (if YES at step S427), 80percent of the contrast value (P[PN-3]) of the lens position (PN-3) thatbecomes a maximum value among the group of obtained five contrast valuesis assigned to the lower limit value dat0 (step S429). Subsequently, itis determined whether or not a first condition for reliability issatisfied, i.e., whether or not either the contrast value P[PN-5] at thelens position (PN-5), which is one of the opposite end positions of thefive lens positions, or the contrast value P[PN-1] at the lens position(PN-1), which is the other of the opposite end positions of the fivelens positions, is smaller than the lower limit value dat0 (step S431).Namely, it is determined whether or not the difference between the peakcontrast value and each contrast value at the opposite end positions ofthe five lens positions is sufficiently large. If neither of thecontrast value P[PN-5] at the lens position (PN-5) and the contrastvalue P[PN-1] at the lens position (PN-1) is smaller than the lowerlimit value dat0 (if NO at step S431), control returns to step S426 sothat the operations at steps S427 through S431 are performed for thesubsequent support area. This is because it is assumed that thereliability of the peak contrast value is low since the contrastvariation is small.

If either the contrast value P[PN-5] at the lens position (PN-5) or thecontrast value P[PN-1] at the lens position (PN-1) is smaller than thelower limit value dat0 (if YES at step S431), it is determined whetheror not a second condition for reliability is satisfied, i.e., whether ornot the difference between the peak contrast value P[PN-3] and theminimum contrast value among all the contrast values obtained by theprevious processes performed thus far is greater than 10 percent of thepeak contrast value P[PN-3] (step S433). Otherwise (if NO at step S433),control returns to step S426 so that the operations at steps S427through S433 are performed for the subsequent support area. This isbecause it is assumed that the reliability of the peak contrast value islow since the peak contrast value is small.

If the difference between the peak contrast value P[PN-3] and theminimum contrast value among all the contrast values obtained by theprevious processes performed thus far is greater than 10 percent of thepeak contrast value P[PN-3] (if YES at step S433), it is determinedwhether or not a third condition for reliability is satisfied, i.e.,whether or not the peak contrast value P[PN3] is equal to or greaterthan the maximum contrast value (step S435). If the peak contrast valueP[PN3] is not equal to or greater than the maximum contrast value (if NOat step S435), control returns to step S426 so that the operations atsteps S427 through S435 are performed for the subsequent support area.If the peak contrast value P[PN3] is equal to or greater than themaximum contrast value (if YES at step S435), the lens-position pulsenumber (PN-3) at which the peak contrast value P[PN-3] has been obtainedis assigned to the position index INDEX while the peak existence flagSTATUS is set to “1” (step S437), and control proceeds to step S439.

At step S439 it is determined whether or not the contrast values P[PN-5]and P[PN-1], that are obtained at the opposite end positions ofconsecutive five lens positions at which a group of five contrast valuesare respectively obtained by the peak check process, are greater thanthe contrast values P[PN-6] and P[PN], respective, that are obtained atlens positions immediately after and before the aforementioned oppositeend positions at which the contrast values P[PN-5] and P[PN-1] areobtained, respectively. Namely, it is determined whether or not the peakcontrast value P[PN-3] is a peak contrast value obtained in the casewhere the contrast value increases three times consecutively, andsubsequently decreases three times consecutively. If the peak contrastvalue P[PN-3] is such a peak contrast value (if YES at step S439), themidway-stop check flag for support area is set to “1” (step S441) andcontrol proceeds to step S443. If the peak contrast value P[PN-3] is notsuch a peak contrast value (if NO at step S439), control returns to stepS426 so that the operations at steps S427 through S439 are performed forthe subsequent support area. Since strict conditions are set up in thecase of terminating the search operation during the progress thereof,the possibility of an error focusing occurring is low.

At step S443 it is determined whether or not the digital camera iscurrently in the single-peak-occurrence stop mode. If the digital camerais currently in the single-peak-occurrence stop mode (if YES at stepS443), a single-peak-occurrence stop check process is performed (S445),and control returns. If the digital camera is not currently in thesingle-peak-occurrence stop mode (if NO at step S443), amulti-peak-occurrence stop check process is performed (S447), andcontrol returns.

[Single-Peak-Occurence Stop Check Process]

The single-peak-occurrence stop check process that is performed at stepS445 will be hereinafter discussed in detail with reference to the flowchart shown in FIG. 10. In this process, firstly it is determinedwhether or not the midway-stop identification flag is “0” (step S501).The midway-stop identification flag is “0” when control first enters thesingle-peak-occurrence stop check process, so that control proceeds to aloop process at steps S502 through S506.

In the loop process at steps S502 through S506, it is determined whetheror not the midway-stop check flag is “1” for each area (step S503). Thearea for which the midway-stop check flag is set to “1” is the area onwhich it is determined that the peak contrast value P[PN-3] is a peakcontrast value obtained in the case where the contrast value increasesthree times consecutively, and subsequently decreases three timesconsecutively, and for which the midway-stop check flag is set to “1” atstep S441. If it is determined at step S503 that the midway-stop checkflag is not “1” (if NO at step S503), control returns to step S502 andit is determined whether or not the midway-stop check flag is “1” forthe subsequent area (step S503).

If it is determined at step S503 that the midway-stop check flag is “1”(if YES at step S503), it is determined whether or not all the followingthree conditions (a) and (b) are satisfied (step S505):

(a) No peak contrast exists in the vicinity of the closest focusposition (near extremity) of the focusing lens group L1 in any otherfocus detection area

(b) A peak contrast exists within plus or minus 1 pulse position even ifexisting in any other focus detection area.

If the additional conditions (a) or (b) are not satisfied (if NO at stepS505), control returns to step S502 so that the operations at steps S503and S505 are performed for the subsequent area. If all the areas do notsatisfy all the two conditions (a) and (b), control returns.

If any area satisfies both of the two conditions (a) and (b) (if YES atstep S505), the midway-stop identification flag is set to “1” (stepS507), the area number of this area is assigned to an area number ANo(step S509), and control returns. Thereafter, the focus detected arearepresented by the area number ANo is selected as an in-focus area inthe area selection process at step S127 (see FIG. 5).

If the midway-stop identification flag is “1” (if NO at step S501), itis determined whether or not the contrast value P[PN] at the currentposition of the focusing lens group L1 is smaller than the contrastvalue P[PN-1] at the immediately preceding position of the focusing lensgroup L1 (step S511). If the contrast value P[PN] is smaller than thecontrast value P[PN-1] (if YES at step S511), the midway-stop OK flag isset to “1” (step S513), and control returns. If the contrast value P[PN]is not smaller than the contrast value P[PN-1] (if NO at step S511),control simply returns.

It is determined at step S501 that the midway-stop identification flagis “1” when control enters the single-peak-occurrence stop check processfor the second time or more, after the midway-stop identification flagis set to “1” at step S507.

It is determined at step S511 that the contrast value P[PN] is smallerthan the contrast value P[PN-1] when the contrast value decreases fourtimes consecutively from a peak contrast (see FIG. 14B).

[Multi-Peak-Occurence Stop Check Process]

The multi-peak-occurrence stop check process that is performed at stepS447 will be hereinafter discussed in detail with reference to the flowchart shown in FIG. 11.

In this process, firstly it is determined whether or not the midway-stopidentification flag is “0” (step S601). The midway-stop identificationflag is “0” when control first enters the multi-peak-occurrence stopcheck process, so that control proceeds to a loop process at steps S602through S608.

In the loop process at steps S602 through S608, it is determined whetheror not the midway-stop check flag is “1” for each area (step S603). Thearea for which the midway-stop check flag is set to “1” is the area onwhich it is determined that the peak contrast value P[PN-3] is a peakcontrast value obtained in the case where the contrast value increasesthree times consecutively, and subsequently decreases three timesconsecutively, and for which the midway-stop check flag is set to “1” atstep S441. If it is determined at step S603 that the midway-stop checkflag is not “1” (if NO at step S603), control returns to step S602 andit is determined whether or not the midway-stop check flag is “1” forthe subsequent area (step S603).

If it is determined at step S603 that the midway-stop check flag is “1”(if YES at step S603), it is determined whether or not the midway-stopcheck flag is “1” for the two support areas of the currently-checkedfocus detection area (step S605) If the midway-stop check flag is not“1” for either of the two support areas of the currently-checked focusdetection area (if NO at step S605), control returns to step S602 sothat the operations at steps S603 and S605 are performed for thesubsequent focus detection area.

If it is determined at step S605 that the midway-stop check flag is “1”for at least one of the two support areas of the currently-checked focusdetection area (if YES at step S605), it is determined whether or notthe above described additional two conditions (a) and (b) are satisfied(step S607).

If the conditions (a) or (b) are not satisfied (if NO at step S607),control returns to step S602 so that the operations at steps S603through S607 are performed for the subsequent focus detection area. Ifall the focus detection areas do not satisfy both the two conditions (a)and (b), control returns.

If both the two conditions (a) and (b) are satisfied (if YES at stepS607), the midway-stop identification flag is set to “1” (step S609),the area number of this focus detection area is assigned to the areanumber ANo (step S611), and control returns. Thereafter, the focusdetected area represented by the area number ANo is selected as anin-focus area in the area selection process at step S127.

If the midway-stop identification flag is “1” (if NO at step S601), itis determined whether or not the contrast value P[PN] at the currentposition of the focusing lens group L1 is smaller than the contrastvalue P[PN-1] at the immediately preceding position of the focusing lensgroup L1 (step S613). If the contrast value P[PN] is smaller than thecontrast value P[PN-1] (if YES at step S613), the midway-stop OK flag isset to “1” (step S615), and control returns. If the contrast value P[PN]is not smaller than the contrast value P[PN-1] (if NO at step S613),control simply returns.

It is determined at step S601 that the midway-stop identification flagis “1” when control enters the multi-peak-occurrence stop check processfor the second time or more, after the midway-stop identification flagis set to “1” at step S609.

It is determined at step S613 that the contrast value P[PN] is smallerthan the contrast value P[PN-1] when the contrast value decreases fourtimes consecutively from a peak contrast (see FIG. 14B).

If the midway-stop OK flag is set to “1” by the single-peak-occurrencestop check process or the multi-peak-occurrence stop check processtherein, control returns to the contrast AF process shown in FIG. 5,goes from step S119 to step S123, and control ends via steps S125through S129 to complete the search operation.

As can be understood from the foregoing, according to the presentembodiment of the digital camera, when object brightness is low or theimage pickup device 11 operates in the CCD low-speed drive mode, andwhen an in-focus state is detected in any of the five focus detectionareas MM0 through MM4 by the multi-peak-occurrence stop check process,the lens position of the focusing lens group L1 at which an in-focusstate is obtained in that focus detection area is determined as anin-focus position if an in-focus state is detected in both the focusdetection area (MM0, MM1, MM2, MM3 or MM4) and at least one of theassociated two support areas (MS0 and MS1, MS0 and MS2, MS1 and MS3, MS2and MS4 or MS3 and MS5), and if both the above described two conditions((a) no peak contrast exists in the vicinity of the closest focusposition (near extremity) of the focusing lens group L1 in any otherfocus detection area, and (b) a peak contrast exists within plus orminus 1 pulse position even if existing in any other focus detectionarea) are satisfied, which minimizes the chances of the occurrence of afocus error.

Obvious changes may be made in the specific embodiment of the presentinvention described herein, such modifications being within the spiritand scope of the invention claimed. It is indicated that all mattercontained herein is illustrative and does not limit the scope of thepresent invention.

1. A focus detection method for detecting a focus state based on objectimages formed through a photographing optical system in at least onefocus detection area, while performing a search operation in which afocusing lens group of said photographing optical system is moved fromone toward the other of a near extremity and a far extremity, said focusdetection method comprising: determining at least one support area whichoverlaps said focus detection area; determining a position of saidfocusing lens group at which an in-focus state is detected in said focusdetection area to be an in-focus position of said focusing lens groupwhen a brightness of said object is one of equal to and higher than apredetermined value; and determining a position of said focusing lensgroup at which said in-focus state is detected upon an in-focus statebeing detected in said focus detection area and in said support areawhich overlaps said focus detection area when said brightness of saidobject is lower than said predetermined value.
 2. The focus detectionmethod according to claim 1, wherein said focus detection method isbased on a contrast AF system which detects contrasts of an image whilemoving said focusing lens group stepwise, and determines a position ofsaid focusing lens group at which a peak contrast is obtained to be anin-focus position of said focusing lens group.
 3. The focus detectionmethod according to claim 2, wherein, in a case where said position ofsaid focusing lens group at which said in-focus state is detected insaid focus detection area and said position of said focusing lens groupat which said in-focus state is detected in said support area arepositioned within a predetermined range of stepping positions when saidbrightness of said object is lower than said predetermined value, saidposition of said focusing lens group at which said in-focus state isdetected in said focus detection area is determined to be said in-focusposition of said focusing lens group.
 4. The focus detection methodaccording to claim 1, wherein said focus detection area overlaps atleast two of said focus detection areas, and wherein, upon said in-focusstates being detected in both said focus detection area and at least oneof said two focus detection areas, said position of said focusing lensgroup at which said in-focus state is detected in said focus detectionarea is determined to be said in-focus position of said focusing lensgroup when said object brightness is lower than said predeterminedvalue.
 5. The focus detection method according to claim 1, furthercomprising: stopping said search operation upon determining saidposition of said focusing lens group to be said in-focus position ofsaid focusing lens group even if said focusing lens group does not yetreach said other of said near extremity and said far extremity.
 6. Thefocus detection method according to claim 5, further comprising: addingconditions in order to determine said position of said focusing lensgroup to be said in-focus position of said focusing lens group whenstopping said search operation before said focusing lens group reachessaid other of said near extremity and said far extremity.
 7. The focusdetection method according to claim 1, wherein each of at least two ofsaid focus detection areas overlaps at least one adjacent focusdetection area thereof.
 8. The focus detection method according to claim1, wherein said focusing lens group is moved stepwise by a steppingmotor.
 9. The focus detection method according to claim 1, wherein aplurality of said focus detection areas and a plurality of said supportareas are arranged within a predetermined range corresponding to an areadefined by a focus frame.
 10. A focus detection device comprising: animage pickup device which converts an object image that is formed via aphotographing optical system into electrical image data; a lens drivingdevice which moves a focusing lens group of said photographing opticalsystem along an optical axis thereof; and a controller for detecting afocus state based on image data, converted by said image pickup device,within at least one focus detection area and at least one support area,which overlaps said focus detection area, which are obtained at aplurality of focusing lens group positions while said focusing lensgroup is moved along said optical axis via said lens driving device,wherein said controller determines a position of said focusing lensgroup at which an in-focus state is detected in said focus detectionarea to be an in-focus position of said focusing lens group when anobject brightness is one of equal to and higher than a predeterminedvalue, and wherein said controller detects a focus state in said focusdetection area and said support area, and upon an in-focus state beingdetected in both said focus detection area and said support area whichoverlaps said focus detection area, said controller determines aposition of said focusing lens group at which said in-focus state isdetected in said focus detection area to be an in-focus position of saidfocusing lens group when said object brightness is lower than saidpredetermined value.